<?php
         include('../adodb5/adodb.inc.php');
         $db = ADONewConnection("mysql"); # eg 'mysql' or 'postgres'
         $db->Connect("localhost", "root", "112233", "test");        
		 
		 //DELETE
		 if(isset($_GET['del']) && $_GET['del']==1 && isset($_GET['id']) ){
		 	$db->Execute("delete from customer where id=".addslashes($_GET['id']));			
		 }		 
		 
		 //LIST
		 $rs = $db->Execute('select id,firstname,lastname,age from customer');
         
		 $content = "";
		 $content.="
		 
		 <table border=\"1\">
		 	<tr><td colspan=\"5\"><div align=\"right\"><a href=\"add.php\">Tambah</a></div></td></tr>
		 	<tr>
				<td>ID</td>
				<td>FIRSTNAME</td>
				<td>LASTNAME</td>
				<td>AGE</td>
				<td>ACTION</td>
			</tr>";
		$data = $rs->GetRows();
		for($i=0;$i<count($data);$i++){
			$content.="<tr>
				<td>".$data[$i]['id']."</td>
				<td>".$data[$i]['firstname']."</td>
				<td>".$data[$i]['lastname']."</td>
				<td>".$data[$i]['age']."</td>
				<td><a href=\"edit.php?id=".$data[$i]['id']."\">Edit</a> <a href=\"listarray.php?id=".$data[$i]['id']."&del=1\">Del</a></td>
			</tr>";
		}
		$content.="</table>";
		
		echo $content;
?>
